:root {
  --bg-color: #363433;
  --border-color: #f4f4f4;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-color: #f4f4f4;
    --border-color: #363433;
  }
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  color-scheme: light dark;
}
.dark {
  background-color: #363433;
  color: #f4f4f4;
  border-color: #f4f4f4;
}
.light {
  background-color: #f4f4f4;
  color: #363433;
  border-color: #363433;
}
body {
  background-color: var(--bg-color);
  transition: 0.3s all;
}
ul {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  grid-auto-flow: column;
}
ul li {
  list-style: none;
}

ul li a {
  position: relative;
  display: block;
  width: 150px;
  height: 80px;
  text-align: center;
  line-height: 80px;
  text-decoration: none;
  border: 1px solid var(--border-color);
  color: var(--border-color);
  font-weight: 500;
  /* 必须设置,否则日夜间模式切换后 hover 效果丢失 */
  z-index: 0;
}
li a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s ease-in-out;
}
li a:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}
li:nth-child(1) a::before {
  background-color: #f44336;
}
li:nth-child(2) a::before {
  background-color: #2376b7;
}
li:nth-child(3) a::before {
  background-color: #fff;
}
li:nth-child(4) a::before {
  background-color: #43bcb4;
}
li:nth-child(5) a::before {
  background-color: #000;
}

/* fix: 修复hover 状态下文本颜色 */
li:nth-child(3) a:hover {
  color: var(--border-color);
}
li:nth-child(5) a:hover {
  color: var(--bg-color);
}

ul li a svg {
  width: 20px;
  object-fit: contain;
  vertical-align: text-bottom;
  margin-right: 2px;
}
/* 日夜模式切换部分 */
.switch {
  position: fixed;
  width: 50px;
  height: 25px;
  top: 30px;
  right: 30px;
  /* 让开关按钮看起来垂直居中 */
  vertical-align: middle;
}
.switch input {
  position: absolute;
  display: block;
  width: 20px;
  height: 20px;
  margin: 3px;
  border-radius: 50%;
  border: 2px solid gainsboro;
  cursor: pointer;
  background-color: white;
  /* 取消默认方框 */
  appearance: none;
  z-index: 1;
}
.switch input:checked {
  right: 0;
  border-color: #68d391;
}
.switch input:checked + .toggleLabel {
  background-color: #68d391;
  border: 4px solid #68d391;
}
.switch .toggleLabel {
  position: absolute;
  display: block;
  height: 25px;
  width: 100%;
  overflow: hidden;
  border-radius: 25px;
  border: 4px solid gainsboro;
  background-color: gainsboro;
  cursor: pointer;
}
